# coding:utf-8
import os
from app.parameters import ia_token
from app.parameters.ia_query import select_config
from app.parameters.ia_configure import account_vice
import hashlib
# from app.test_run.run_ticktocks import ticktocks_main
# from app.test_run.run_users import users_main
# from app.test_run.run_groups import groups_main
# from app.test_run.run_blued import blued_main
# from app.test_run.run_h5 import h5_main
# from app.test_run.run_pay import pay_main
#401  用户名和密码错误
#4036002 验证码错误
def main(i_users,i_groups,i_blued,i_ticktocks,i_h5,i_pay,i_chatrooms,i_passport):
        users = str(select_config()[12])
        p = str(select_config()[13])
        passwords = hashlib.sha1(p).hexdigest()
        is_online= select_config()[11]
        if is_online==0:
            #域名和网址配置
            url_ym='http://106.75.141.41'
        elif is_online==1:
            #域名和网址配置
            url_ym='https://argo.blued.cn'
        else:
            url_ym=str(select_config()[10])
        jianquan = ia_token.addHeader(1,users,passwords,url_ym,1)#需要鉴权
        jianquan_no = ia_token.addHeader(0,users,passwords,url_ym,0)#不需要鉴权
        # vice_jianquan = ia_token.addHeader(1,account_vice[0],account_vice[1],url_ym,0) #副账号
        if jianquan[0] == 0:
            return jianquan
        else:
            if i_users == 1:
                os.system("python qa/interface/users.py")
                # users_main()
            if i_groups == 1:
                os.system("python qa/interface/groups.py")
                # groups_main()
            if i_blued == 1:
                os.system("python qa/interface/blued.py")
                # blued_main()
            if i_ticktocks == 1:
                os.system("python qa/interface/ticktocks.py")
                # ticktocks_main()
            if i_chatrooms == 1:
                os.system("python qa/interface/chatrooms.py")
                # h5_main()
            if i_passport == 1:
                os.system("python qa/interface/passport.py")
            if i_h5 == 1:
                os.system("python qa/interface/h5.py")
                # h5_main()
            if i_pay == 1:
                os.system("python qa/interface/pay.py")